/*
#Copyright (c) 2013, Philippe Bordron <philippe.bordron@gmail.com>
#
# This file is part of SIPPER.
#
# DCC is free software: you can redistribute it and/or modify
# it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# DCC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU LESSER GENERAL PUBLIC LICENSE for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# along with SIPPER.  If not, see <http://www.gnu.org/licenses/>
*/
package combi.graph;
import java.util.HashSet;
import java.util.Set;

import org.jgrapht.graph.MaskFunctor;

	public class Mask<V, E> implements MaskFunctor<V,E>
	{

		Set<V> vertexMask;
		Set<E> edgeMask;

		public Mask()
		{
			vertexMask = new HashSet<V>();
			edgeMask = new HashSet<E>();
		}
		

		public Mask(Mask<V,E> m)
		{
			vertexMask = new HashSet<V>(m.vertexMask);
			edgeMask = new HashSet<E>(m.edgeMask);
		}
		
		public void clear()
		{
			vertexMask.clear();
			edgeMask.clear();
		}
		
		public boolean addVertex(V vertex)
		{
			return vertexMask.add(vertex);
		}

		
		public boolean addEdge(E edge)
		{
			return edgeMask.add(edge);
		}
		
		public boolean removeVertex(V vertex)
		{
			return vertexMask.remove(vertex);
		}
		
		public boolean removeEdge(E edge)
		{
			return edgeMask.remove(edge);
		}
		
		@Override
		public boolean isEdgeMasked(E edge) {
			return edgeMask.contains(edge);
		}

		@Override
		public boolean isVertexMasked(V vertex) {
			return vertexMask.contains(vertex);
		}
		
	}